home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-01-14 | 3.1 KB | 117 lines | [TEXT/MPS ] |
- /* _________________________________________________________________________________________________________ //
- Copyright © 1992 Apple Computer, Inc. All rights reserved.
- Macintosh Developer Technical Support.C++ Macintosh Toolbox Framework.
- Programmer: Kent Sandvik
- Date: 11/9/92
- Revision comments are at the end of this file.
- ---
- TEnvironment is a Gestalt wrapper class that finds out information about the environment.
- Environment.cp contains the member functions for the TEnvironment class.
- _________________________________________________________________________________________________________ */
-
- // INCLUDES
- #ifndef _ENVIRONMENT_
- #include "Environment.h"
- #endif
-
-
- // _________________________________________________________________________________________________________ //
- // TEnvironment class member function implementations
-
- // CONSTRUCTORS & DESTRUCTORS
- #pragma segment Environment
- TEnvironment::TEnvironment()
- {
- // Set fields to known values.
- fResult = false;
- fLongResult = 0L;
- }
-
- #pragma segment Environment
- TEnvironment::~TEnvironment()
- {
-
- }
-
-
- // MAIN INTERFACE
-
- #pragma segment Environment
- Boolean TEnvironment::HasAttribute(OSType attribute,
- short theBit)
- // Generic test that takes the Gestalt attribute and the bit value, and returns a Boolean.
- {
- return (::Gestalt(attribute, &fLongResult) == noErr) && (((fLongResult >> theBit) & 1) != 0);
- }
-
-
- #pragma segment Environment
- Boolean TEnvironment::Check128k()
- // Checks if we are running under a 128k or better ROM.
- {
- // check if 128k ROM Macintosh or not - the framework will not work properly
- // on 64k ROM systems...
-
- SysEnvRec envRec;
-
- // ignore the error returned from SysEnvirons; even if an error occurred,
- // the SysEnvirons glue will fill in the SysEnvRec
- (void)::SysEnvirons(curSysEnvVers, &envRec);
-
- if (envRec.machineType < 0) // are we running on a 128K ROM machine or better???
- return false; // we don't have a 128k System
- else
- return true; // we have a 128k System or better
- }
-
-
- #pragma segment Environment
- Boolean TEnvironment::HasAppleEvents()
- // Check if we have Apple Events support or not.
- {
- fResult = (::Gestalt(gestaltAppleEventsAttr, &fLongResult) == noErr);
- return fResult;
- }
-
-
- #pragma segment Environment
- Boolean TEnvironment::HasColorQD()
- // Check if we have Color QuickDraw support or not.
- {
- fResult = (::Gestalt(gestaltQuickdrawFeatures, &fLongResult) == noErr);
- return fResult;
- }
-
-
- #pragma segment Environment
- Boolean TEnvironment::IsSystemSeven()
- // Check if we are running on a System 7 version.
- {
- ::Gestalt(gestaltSystemVersion, &fLongResult);// check for system version
-
- if (fLongResult >= 0x0700)
- return true;
- else
- return false;
- }
-
-
- #pragma segment Environment
- Boolean TEnvironment::TrapAvailable(short aNumber,
- TrapType aType)
- // Check if the trap is implemented or not.
- {
- // Return true if trap is available
- return (::NGetTrapAddress(aNumber, aType) != GetTrapAddress(_Unimplemented));
- }
-
-
- // _________________________________________________________________________________________________________ //
-
-
- /* Change History (most recent last):
- No Init. Date Comment
- 1 khs 11/9/92 New file
- */
-
-